<!--
 * @Author: 471826078@qq.com
 * @Date: 2020-06-03 09:21:01
 * @LastEditors: zhangfan
 * @LastEditTime: 2021-06-16 11:06:08
-->
<template>
  <div class="container mainCon">
    <div class="mainConHeader">
      <div class="mainConHeaderContent"></div>
      <el-tabs
        v-model="activeName"
        type="card"
        @tab-click="handleClick"
        class="commonTab commonTabDouble"
      >
        <el-tab-pane
          :label="item.label"
          :name="item.id"
          v-for="item in list"
          :key="item.id"
        ></el-tab-pane>
      </el-tabs>
      <tobePerfectCount
        :activeName="parseInt(activeName) - 1"
        @callBackActive="callBackActive"
        v-if="1 == activeName"
      />
      <unRealName
        @setList="setList"
        :areaId="areaId"
        :industryId="industryId"
        :status="status"
        :investment="investment"
        :industry="industry"
        :investmentType="investmentType"
        :tabList="list"
        :activeName="parseInt(activeName) - 1"
        v-else
      />
    </div>
  </div>
</template>
<script>
import tobePerfectCount from '@/components/dynamicService/tobePerfectCount'
import unRealName from '@/components/dynamicService/unRealName'
export default {
  name: 'tobePerfect',
  components: {
    tobePerfectCount,
    unRealName,
  },
  data() {
    return {
      activeName: '1',
      areaId: '',
      industryId: '',
      status: '',
      investment: '',
      industry: '',
      investmentType: '',
      list: [
        // {
        //     id: "1",
        //     label: "待完善项目统计",
        //     isDefault: true,
        //     name: "typeOne"
        // },
        //   {
        //     id: "2",
        //     label: "未落实实名制项目",
        //     isDefault: true,
        //     name: "realTotal"
        // },
        //   {
        //     id: "3",
        //     label: "未实名制考勤项目",
        //     isDefault: true,
        //     name: "realAllTotal"
        // },
        // {
        //     id: "4",
        //     label: "未录入专户的项目",
        //     isDefault: true,
        //     name: "inputBankTotal"
        // },
        // {
        //     id: "5",
        //     label: "专户已开设,未缴存资金项目",
        //     isDefault: true,
        //     name: "depositFundTotal"
        // },
        // {
        //     id: "6",
        //     label: "已开设专户，未代发工资项目",
        //     isDefault: true,
        //     name: "payTotal"
        // },
        // {
        //     id: "7",
        //     label: "上月未制作工资表项目",
        //     isDefault: true,
        //     name: "lastMonthPayTotal"
        // },
        // {
        //     id: "8",
        //     label: "专户已开设，近60天未代发工资项目",
        //     isDefault: true,
        //     name: "payDayTotal"
        // },
        // {
        //     id: "9",
        //     label: "未上传维权公示牌项目",
        //     isDefault: true,
        //     name: "psTotal"
        // },
        // {
        //     id: "10",
        //     label: "未缴纳保证金项目",
        //     isDefault: true,
        //     name: "depositAccessTotal"
        // },
        // {
        //     id: "11",
        //     label: "无资金拨付的财政项目",
        //     isDefault: true,
        //     name: "availableFiscalTotal"
        // }
      ],
    }
  },
  mounted() {},
  created() {
    this.getTabData()
  },
  methods: {
    handleClick(tab, event) {
      console.log(tab.name)
      this.$nextTick(() => {
        $('#tab-' + tab.name)
          .prevAll()
          .addClass('beforeLine')
      })

      // document.getElementsByClassName('el-tabs__nav')
      // 初始化 清除从待完善列表传过来的值
      this.areaId = ''
    },
    callBackActive(val) {
      this.activeName = val.type + ''
      this.areaId = val.areaId + ''
      this.industryId = val.industryId + ''
      this.status = val.status + ''
      this.investment = val.investment + ''
      this.industry = val.industry + ''
      this.investmentType = val.investmentType + ''
    },
    setList(val) {
      const { list, activeName } = val
      const arr = this.list[activeName]
      arr.children = list
      this.$set(this.list, activeName, arr)
      this.list = JSON.parse(JSON.stringify(this.list))
    },
    getTabData() {
      this.axios({
        method: 'post',
        url: '/api-s/dimension/findhead',
      })
        .then(
          (response) => {
            if (!response.data.hasError) {
              this.list = response.data.result
              if (!this.isEsUser()) {
                this.list.pop()
              }
              console.log(this.list)
            } else {
            }
          },
          (response) => {}
        )
        .catch((error) => {})
    },
  },
}
</script>
<style lang="less" scoped>
.mainCon {
  top: 132px;
  padding: 0;
  &Header {
    position: relative;
    &Content {
      position: absolute;
      left: 130px;
      z-index: 100;
      font-size: 12px;
      color: #666666;
    }
  }
  /deep/.el-tabs__nav-wrap {
    padding: 0 36px;
    .el-tabs__nav-prev {
      width: 36px;
      text-align: center;
      margin-top: 1px;
      line-height: 46px;
      // position: relative;
      //   &::before{
      //   content: '';
      //   position: absolute;
      //   width: 1px;
      //   height: 16px;
      //   top: 15px;
      //   right: 0;
      //   opacity: 0.2;
      //   background-color:  #979797;
      // }
    }
    .el-tabs__nav-next {
      width: 36px;
      text-align: center;
      margin-top: 1px;
      line-height: 46px;
      //   &::before{
      //   content: '';
      //   position: absolute;
      //   width: 1px;
      //   height: 16px;
      //   top: 15px;
      //   left: 0;
      //   opacity: 0.2;
      //   background-color:  #979797;
      // }
    }
    .el-tabs__item {
      &:first-child {
        // margin-left: 15px;
      }
      &:last-child {
        margin-right: 12px !important;
      }
    }
  }
}
/deep/.commonTab {
  .el-tabs__nav-scroll {
    padding-left: 0;
  }
  background-color: #f3f3f3;
  .el-tabs__header {
    border: none;
  }

  .el-tabs__item.is-active::after {
    bottom: 44px;
  }
  .el-tabs__item {
    border-bottom: 1px solid #e3e7e9;
    padding: 0 13px !important;
    margin: 0 !important;
    position: relative;
    &::before {
      content: '';
      position: absolute;
      width: 1px;
      height: 16px;
      top: 15px;
      right: 0;
      opacity: 0.2;
      background-color: #979797;
    }
  }
  .beforeLine {
    &::before {
      left: 0 !important;
    }
  }
  .el-tabs__item.is-active {
    border-color: #fff;
    &::before {
      background-color: #fff;
      // left: -3px;
      // width: 5px;
    }
  }
}
/deep/ .el-tabs__nav-next {
  .el-icon-arrow-right:before {
    content: '\e6dc' !important;
  }
  .el-icon-arrow-right:after {
    content: '';
    position: absolute;
    width: 1px;
    height: 16px;
    top: 15px;
    right: 36px;
    opacity: 0.2;
    background-color: #979797;
  }
}
/deep/.el-tabs__nav-prev {
  .el-icon-arrow-left:before {
    content: '\e6dd' !important;
  }
  .el-icon-arrow-left:after {
    content: '';
    position: absolute;
    width: 1px;
    height: 16px;
    top: 14px;
    left: 36px;
    opacity: 0.2;
    background-color: #979797;
  }
}
</style>
